package com.test.tmpmode;

/**
 * 模板模式测试
 */
public abstract class Account {
    //顶级逻辑
    public final double calFee() {
        return getCount() * getDiscount();
    }

    //基本逻辑
    protected abstract int doGetType();

    private double getDiscount() {
        if (doGetType() == 1) {
            return 0.02;
        } else {
            return 0.01;
        }
    }

    private double getCount() {
        return 10000;
    }
}
